package config;

public class Sql2appConfig {
	//---------------------------------------------------------------交易执行sql------------------------------------------------------------------------------------------
		public static String insertTransaction = "insert into transaction (transaction_orderNum,transaction_userID,transaction_receiveAddr,transaction_status,transaction_sendAndReceiveType,transaction_receiveOrderTimeStart,transaction_sendOrderTimeEnd,transaction_sendOrderTimeStart,transaction_receiveOrderTimeEnd,transaction_startTime,transaction_payment,transaction_check,transaction_paymentPrice,transaction_totalNums,transaction_comment) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
		public static String insertTransactionDetail = "insert into transaction_details (transaction_details_goodsName,transaction_details_goodsPrice,transaction_details_description,transaction_details_goodsNum,transaction_details_orderNum) values (?,?,?,?,?)";
		public static String insertTransactionLog = "insert into transaction_log (transaction_log_userID,transaction_log_time,transaction_log_description,transaction_log_orderNum) values (?,?,?,?)";
		//public static String insertTradeAddr = "insert into transaction_address (transaction_address_userID,transaction_address_type,transaction_address_province,transaction_address_city,transaction_address_area,transaction_address_street,transaction_address_addr,transaction_address_name,transaction_address_mobileNum,transaction_address_status) values (?,?,?,?,?,?,?,?,?,?)";
		public static String insertTradeAddr = "insert into user_address (user_address_userID,user_address_type,user_address_province,user_address_city,user_address_area,user_address_street,user_address_addr,user_address_name,user_address_mobileNum,user_address_status) values (?,?,?,?,?,?,?,?,?,?)";
		public static String insertNorUserBill = "insert into log_noruserbill(log_norUserBill_userID,log_norUserBill_updateTime,log_norUserBill_money,log_norUserBill_balance,log_norUserBill_contentType,log_norUserBill_content,log_norUserBill_payment,log_norUserBill_payMobile,log_norUserBill_inSeq,log_norUserBill_type,log_norUserBill_status) values(?,?,?,?,?,?,?,?,?,?,?)";
		public static String insertLogIncome = "insert into log_income(log_income_typeId,log_income_orgId,log_income_orgName,log_income_agentId,log_income_userId,log_income_createTime,log_income_money,log_income_feedbackMoney,log_income_channel,log_income_inSeq,log_income_status) values(?,?,?,?,?,?,?,?,?,?,?)";
		
		public static String updateTransaction = "update transaction set transaction_paymentPrice=?,transaction_totalNums=? where transaction_orderNum=?";
		//public static String updateTradeAddr = "update transaction_address set transaction_address_province=?,transaction_address_city=?,transaction_address_area=?,transaction_address_street=?,transaction_address_addr=?,transaction_address_name=?,transaction_address_mobileNum=?,transaction_address_status=? where transaction_address_id=?";
		public static String updateTradeAddr = "update user_address set user_address_province=?,user_address_city=?,user_address_area=?,user_address_street=?,user_address_addr=?,user_address_name=?,user_address_mobileNum=?,user_address_status=? where user_address_id=?";
		public static String updateTransactionPay = "update transaction set transaction_payment=? where transaction_orderNum=?";
		public static String updateUserBalance = "update user set user_balance=? where user_mobileNum=? and user_status=0";
		public static String updateNorUserBillStatus = "update log_noruserbill set log_norUserBill_outTradeNo=?,log_norUserBill_balance=?,log_norUserBill_status=1 where log_norUserBill_inSeq=?";
		public static String updateLogIncomeStatus = "update log_income set log_income_outSeq=?,log_income_balance=?,log_income_status=1 where log_income_inSeq=?";
		
		public static String deleteTransaction = "update transaction set transaction_status=? where transaction_orderNum=?";
		public static String deleteTransactionDetail = "delete from transaction_details where transaction_details_orderNum=?";
		//public static String deleteTradeAddr = "update transaction_address set transaction_address_status=? where transaction_address_id=?";
		public static String deleteTradeAddr = "update user_address set user_address_status=? where user_address_id=?";
		
		public static String queryCommodities = "select tc.transaction_commodity_id,tc.transaction_commodity_name,tc.transaction_commodity_picture,tc.transaction_commodity_description,tc.transaction_commodity_price from transaction_commodity tc where tc.transaction_commodity_type=1 limit ?,?";
		//public static String queryTradeAddr = "select ta.transaction_address_id,ta.transaction_address_province,ta.transaction_address_city,ta.transaction_address_area,ta.transaction_address_street,ta.transaction_address_addr,ta.transaction_address_name,ta.transaction_address_mobileNum,ta.transaction_address_status from transaction_address ta left join user u on u.user_id=ta.transaction_address_userID where u.user_weChatNumber=? and ta.transaction_address_status<>'1'";
		public static String queryTradeAddr = "select ta.user_address_id,ta.user_address_province,ta.user_address_city,ta.user_address_area,ta.user_address_street,ta.user_address_addr,ta.user_address_name,ta.user_address_mobileNum,ta.user_address_status from user_address ta left join user u on u.user_id=ta.user_address_userID where u.user_mobileNum=? and u.user_status=0 and ta.user_address_status<>'1' and ta.user_address_type='1'";
		public static String queryTransaction = "select t.transaction_userID,t.transaction_orderNum,t.transaction_startTime,t.transaction_endTime,t.transaction_status,t.transaction_sendAndReceiveType,t.transaction_paymentPrice,t.transaction_totalNums,t.transaction_payment,t.transaction_comment from transaction t where t.transaction_orderNum=?";
		public static String queryTransactionList = "select t.transaction_orderNum,t.transaction_startTime,t.transaction_endTime,t.transaction_status,t.transaction_sendAndReceiveType,t.transaction_paymentPrice,t.transaction_totalNums,t.transaction_payment,t.transaction_check,t.transaction_comment from transaction t left join user u on u.user_id=t.transaction_userID where t.transaction_status not in (5,6) and u.user_mobileNum=? and u.user_status=0";
		public static String queryCompleteTrade = "select t.transaction_payment,t.transaction_orderNum,t.transaction_startTime,t.transaction_endTime,t.transaction_status,t.transaction_sendAndReceiveType,t.transaction_paymentPrice,t.transaction_totalNums,t.transaction_comment from transaction t left join user u on u.user_id=t.transaction_userID where t.transaction_status in (5,6) and u.user_mobileNum=? and u.user_status=0";
		public static String queryTransactionDetails = "select td.transaction_details_goodsName,td.transaction_details_goodsPrice,td.transaction_details_description,td.transaction_details_goodsNum from transaction_details td where td.transaction_details_orderNum=?";
		public static String queryTransactionLogs = "select tl.transaction_log_userID,tl.transaction_log_time,tl.transaction_log_description from transaction_log tl where tl.transaction_log_orderNum=?";
		public static String queryCommodityById = "select * from transaction_commodity t where t.transaction_commodity_id = ?";
		public static String queryTransactionPayStatus = "select t.transaction_payment from transaction t where t.transaction_orderNum=?";
		public static String queryLogncomeStatus = "select li.log_income_status from log_income li where li.log_income_inSeq=?";
		public static String queryLogNorUserBillCount = "select count(ln.log_norUserBill_id) from log_noruserbill ln where ln.log_norUserBill_inSeq=?";
		public static String queryUserBalance = "select u.user_balance from user u where u.user_mobileNum=? and u.user_status=0 for update";
		public static String queryUserOpenId = "select u.user_weChatNumber from user u where u.user_status=0 and  u.user_mobileNum=? limit 1";
		public static String queryUserIdByMobileNum = "select u.user_id from user u where u.user_status=0 and u.user_mobileNum=? limit 1";
		public static String queryLogNorUserBill="select lub.log_norUserBill_inSeq,lub.log_norUserBill_money,lub.log_norUserBill_balance,lub.log_norUserBill_updateTime from log_noruserbill lub where lub.log_norUserBill_status=1 and  lub.log_norUserBill_userID=? order by lub.log_norUserBill_updateTime desc";
		public static String queryLogincome="select li.log_income_channel,li.log_income_createTime,li.log_income_balance,li.log_income_money from log_income li where li.log_income_status=1 and li.log_income_typeId=5 and li.log_income_orgId=? order by li.log_income_createTime desc";
		
		
		public static String wxUserCenter = "select u.user_id,u.user_firstName,u.user_lastName,u.user_mobileNum,u.user_icon,u.user_balance from user u where u.user_mobileNum=? and u.user_status=0 for update";
		//public static String clearAddrStatus = "update transaction_address set transaction_address_status=? where transaction_address_status<>'1' and transaction_address_userID=?";
		public static String clearAddrStatus = "update user_address set user_address_status=? where user_address_status<>'1' and user_address_userID=? and user_address_type=1";
}
